/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.knowledge.facts.paths;

import com.environment.Aim;
import com.environment.Percept;
import com.environment.Tile;
import com.knowledge.facts.Fact;
import java.util.List;

/**
 *
 * @author ihcfan
 */
public abstract class PathFact extends Fact {
    protected List<Aim> directions;
    protected Tile source;
    protected int utility;

    public Tile getSource() {
        return source;
    }
    
    public PathFact(Tile source, Tile destination, List<Aim> directions) {
        this.source = source;
        this.location = destination;
        this.directions = directions;
    }

    public Aim getNextAim() {
        Aim aim = directions.iterator().next();
        
        return aim;
    }
    
    public void updateSource() {
        Aim aim = directions.iterator().next();
        source = Percept.getInstance().getTile(source, aim);
        directions.remove(0);        
    }

    public int getRemainingSteps() {
        return directions.size();
    }
    
    public int getUtility() {
        return utility;
    }
    
    public void setUtility(int utility) {
        this.utility = utility;
    }

    public void addFirst(Aim aim) {
        directions.add(0,aim);
    }

}
